<template>
    <div class="zuojiazhuye">
        <div class="avatar">
            <div class="avater_title"></div>
            <div class="author_name">
                <span>{{this.mybookData.author}}</span>
                <div class="author_intro">
                    这个人还没有介绍哦
                </div>
            </div>
        </div>
        <div class="author_books">
            作者介绍:{{this.mybookData.author}} 本站作家，笔下著有小说《{{ this.mybookData.bookname }}》
            <br>
            {{ this.authorrizer }}
        </div>
    </div>
</template>
<style lang="less">
.zuojiazhuye {
    overflow: scroll;
    height: 30vh;
    text-align: left;

    .avatar {
        margin: 0 5vw;
        height: 12vh;
        background-color: rgb(255, 250, 240);

        div {
            display: inline-block;
        }

        .avater_title {
            width: 10vh;
            height: 10vh;
            border-radius: 50%;
            background-image: url(../img/辣椒.png);
            background-repeat: no-repeat;
            background-size: cover;
            position: relative;
            left: 0;
            border: 1px solid #ff8820;
        }

        .author_name {
            margin-left: 10px;

            span {
                margin-bottom: 8px;
                display: block;
                position: relative;
                top: 0;
                background-color: rgb(255, 136, 32);
                width: 30vw;
                overflow: hidden;
                text-align: center;
                border-radius: 40px;
                color: white;
                font-weight: bold;
            }

            div {
                display: block;
                font-size: 12px;
            }
        }

    }

    .author_books {
        width: 90vw;
        margin: 0 5vw;
        height: 14vh;
        margin-top: 2vh;
        background-color: rgb(243, 243, 243);
        padding: 10px;
        overflow: scroll;
    }
}
</style>
<script>
// 导入书籍详情接口
import { booksub } from '../api/myindex';
export default {
    name: 'zuojiazhuyeView',
    data() {
        return {
            arr: [],
            mybookData: {
                author: "",
                bookname: "",
                bookid: "",
            },
            authorrizer: "",

        }
    },

    created() {
        console.log(this.$route.query);
        this.mybookData.bookid = this.$route.query.id;
        this.mybookData.bookname = this.$route.query.name;
        this.getmydata1();
    },
    methods: {
        async getmydata1() {
            try {
                // 调用接口
                const response = await booksub({
                    id: this.mybookData.bookid,
                    title: this.mybookData.bookname
                });
                // 请求成功
                console.log("请求成功！");
                if (response) {
                    console.log("myarr-->", response.feed);
                    // console.log("作者出版", response.feed.entry['pris:book'].authorizer);
                    
                    // 数据赋值
                    // 作者
                    this.mybookData.author = response.feed.entry.author.name;
                    // 公司
                    this.authorrizer = response.feed.entry['pris:book'].authorizer;
                    console.log("mybookData",this.mybookData);

                }
            } catch (err) {
                // 请求失败
                console.log("请求失败,请刷新", err);
            }
        },
    }
}
</script>